{extend name="template/base" /}
{block name="content"}
<!--<div class="page-container">-->
    <!--&lt;!&ndash;<form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">&ndash;&gt;-->
        <!--&lt;!&ndash;<input type="hidden" name="id" value="{$vo.id ?? ''}">&ndash;&gt;-->
        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<label class="form-label col-xs-3 col-sm-3">标题：</label>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="formControls col-xs-6 col-sm-6">&ndash;&gt;-->
                <!--&lt;!&ndash;<input type="text" class="input-text" placeholder="标题" name="title" value="{$vo.title ?? ''}" >&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-3 col-sm-3"></div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<label class="form-label col-xs-3 col-sm-3">是否阅读：</label>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="formControls col-xs-6 col-sm-6">&ndash;&gt;-->
                <!--&lt;!&ndash;<input type="text" class="input-text" placeholder="是否阅读" name="isread" value="{$vo.isread ?? ''}" >&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-3 col-sm-3"></div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<label class="form-label col-xs-3 col-sm-3">阅读时间：</label>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="formControls col-xs-6 col-sm-6">&ndash;&gt;-->
                <!--&lt;!&ndash;<input type="text" class="input-text" placeholder="阅读时间" name="read_time" value="{$vo.read_time ?? ''}" >&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-3 col-sm-3"></div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<label class="form-label col-xs-3 col-sm-3">内容：</label>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="formControls col-xs-6 col-sm-6">&ndash;&gt;-->
                <!--&lt;!&ndash;<input type="text" class="input-text" placeholder="内容" name="content" value="{$vo.content ?? ''}" >&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-3 col-sm-3"></div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<label class="form-label col-xs-3 col-sm-3">消息类型：</label>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="formControls col-xs-6 col-sm-6">&ndash;&gt;-->
                <!--&lt;!&ndash;<input type="text" class="input-text" placeholder="消息类型" name="type" value="{$vo.type ?? ''}" >&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-3 col-sm-3"></div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<label class="form-label col-xs-3 col-sm-3">用户：</label>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="formControls col-xs-6 col-sm-6">&ndash;&gt;-->
                <!--&lt;!&ndash;<input type="text" class="input-text" placeholder="用户" name="user_id" value="{$vo.user_id ?? ''}" >&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-3 col-sm-3"></div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->

        <!--&lt;!&ndash;<div class="row cl">&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">&ndash;&gt;-->
                <!--&lt;!&ndash;<button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>&ndash;&gt;-->
                <!--&lt;!&ndash;<button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->
    <!--&lt;!&ndash;</form>&ndash;&gt;-->
<!--</div>-->
<link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
<script src="/static/admin/layui/layui.js"></script>
<div class="page-container">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>
    <form class="layui-form" action="/admin/notify/add" method="post">
        <input type="hidden" name="id" value="{$info.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input type="text" placeholder="请输入标题" autocomplete="off" name="title" class="layui-input" value="{$info.title ?? ''}" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否阅读</label>
            <div class="layui-input-block">
                <select name="isread" lay-verify="" disabled>
                    <option value="0">请选择是否已阅读</option>
                    <option {if ($info.isread == 1)} selected {/if} value="1">是</option>
                    <option {if ($info.isread == 0)} selected {/if} value="0">不是</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">阅读时间</label>
            <div class="layui-input-block">
                {empty name="$info['read_time']"}
                <input type="text" placeholder="请输入阅读时间" readonly autocomplete="off" class="layui-input" name="read_time" value="0">

                {else /}
                <input type="text" placeholder="请输入阅读时间" disabled autocomplete="off" class="layui-input" name="read_time" value="{$info.read_time | date='Y-m-d H:i:s',###}">
                {/empty}
              </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-block">
                <textarea name="content" placeholder="请输入内容" class="layui-textarea">{$info.content ?? ''}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">消息类型</label>
            <div class="layui-input-block">
                <select name="type" lay-verify="" lay-search>
                    <option value="system_ordinary_info">系统普通消息</option>
                    {foreach $type as $type}
                    <option {if ($info['type'] == $type['value'])} selected {/if} value="{$type.value}">{$type.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户</label>
            <div class="layui-input-block">
                <select name="user_id" lay-verify="" lay-search>
                    <option value="">请选择用户</option>
                    {foreach $userInfos as $user}
                    <option {if ($info['user_id'] == $user['id'])} selected {/if} value="{$user.id}">{$user.realname}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit lay-filter="formDemo">修改信息</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>

    layui.use('form',function () {
        var form = layui.form
        form.on('submit(formDemo)',function (data) {
            console.log('data',data)
            //使用ajax提交数据
            $.ajax({
                type: 'post',
                url: '/admin/notify/edit',
                data: data.field,
                success: function (res) {
                    // console.log('res', res);
                    if (res.msg){
                        layer.msg(res.msg)
                    } else{
                        layer.msg('非法操作')
                    }
                    if (!res.code){
                        window.parent.location.reload() // 添加成功，关闭
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index)
                    }
                }
            });
            return false
        })

    });
    $(function () {
;

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });
    })
</script>
{/block}
